<#assign webroot=request.getContextPath()>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>移动休闲馆</title>
	<script type="text/javascript" src="${webroot}/resources/js/jquery-1.7.js"></script>
	<link href="${webroot}/resources/css/xiaoyu_houtai.css" rel="stylesheet" type="text/css" />
	
	<script type="text/javascript">
	$(function(){
	$("#passport").focus();
	}
 	);
		document.onkeydown = function(e){ 
    		var ev = document.all ? window.event : e;
    		if(ev.keyCode==13) {
           		ajaxSubmit();
     		}
		}
		
		var passport_flag = false;		//通行证校验标记  
		var password_flag = false;		//密码校验标记
		function ajaxSubmit(){
			if(check_passport() && check_password()){
				$("#login_form").submit();
				return false;
			}else{
				return false;
			}
		}
	
		function check_passport(){
			var val = $('#passport').val();
			var regex = new RegExp("^[a-zA-Z0-9]{1,20}$");
			if(val=='' || val.length==0){
				$('#login_errors').html("*通行证不能为空");
				$('#login_errors').show();
				return false;
			}
			if(!regex.test(val)){ 
				$('#login_errors').html("*通行证由1－20位的数字、字母组成");
				$('#login_errors').show();
				return false;
			}
			return true;
			passport_flag = true;
		}
	
		function check_password(){
			var val = $('#password').val();
			var regex = new RegExp("^[a-zA-Z0-9]{1,20}$");
			if(val=='' || val.length==0){
				$('#login_errors').html("*密码不能为空");
				$('#login_errors').show();
				return false;
			}
			if(!regex.test(val)){
				$('#login_errors').html("*密码由1－20位的数字、字母组成");
				$('#login_errors').show();
				return false;
			}
			return true;
			password_flag = true;
		}
	</script>
</head>

<body>
<div class="login_box">
	<div class="login">
	<form action="${webroot}/login" method="post" id="login_form">
		<input class="yhm" type="text" name="passport" id="passport"  placeholder="用户名"/>
		<input class="mima" type="password" name="password" id="password" placeholder="密码" />
		<input type="button" class="login_bt" value="" onclick="ajaxSubmit();"/>
		<div class="tishi_1">
			<span class="error" id="login_errors"></span>
		</div>
	</form>
	<#if flash?exists>
	<script type="text/javascript">
	    alert('${flash}');
	    window.location.href ="${webroot}";
	</script>	
    </#if>
	</div>
</div>
</body>
</html>